from django.db import models
from utils.basemodel import BaseModel


# Create your models here.
class CategoryModel(BaseModel):
    cname = models.CharField(max_length=60, verbose_name="分类名称")
    parent = models.ForeignKey("self", null=True, blank=True, on_delete=models.CASCADE, verbose_name="父级分类",
                               related_name="children")
    ishot = models.BooleanField(default=False, verbose_name="是否热门")
    ishome = models.BooleanField(default=False, verbose_name="是否展示在首页")
    idgood = models.BooleanField(default=False, verbose_name="是否推荐")

    class Meta:
        db_table = "fgcategory"

    def __str__(self):
        return self.cname
